#define _GNU_SOURCE
#include "app_pool.h"
#include "log/log.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int task_fun(void *arg)
{
    char *data = (char *)arg;
    log_debug("task %s is running tid=%ld", data,gettid());
    free(data);

}

int main(int argc, char const *argv[])
{
    app_pool_init(5);
    for (int i = 0; i < 10; i++)
    {
        char *name = malloc(10);
        sprintf(name, "task-%d", i);
        app_pool_registerTask( task_fun, name);
    }

    sleep(1);
    log_debug("主函数结束\n");
    app_pool_close();
    return 0;
}
